import { reactive } from "vue"
export const operationItem = reactive({
    defaultSearch: true,//默认搜索按钮
    defaultRefresh: true,//默认重置按钮
    customTableHeader: false,//
    SearchItem: [
		{
			code: 'title',
			name: '标题',
			type: 'input',
		},
		{
			code: 'courseType',
			name: '课程类型',
			type: 'select',
			label: 'name',
			value: 'id'
		},
		{
			code: 'catalogId',
			name: '所属类别',
			type: 'select',
			label: 'name',
			value: 'id'
		},
		{
			code: 'provinceId',
			name: '所属地区',
			type: 'select',
			label: 'name',
			value: 'id'
		},
		{
			code: 'examStatusFlag',
			name: '是否考试动态',
			type: 'select',
			options: [
				{ label: '是', value: 1 },
				{ label: '否', value: 0 }
			]
		},
		{
			code: 'mainArticleFlag',
			name: '是否重点资讯',
			type: 'select',
			options: [
				{ label: '是', value: 1 },
				{ label: '否', value: 0 }
			]
		},
	],
    menuArray: [
		{
			show: true,
			code:'mark',
			type: 'primary',
			text: '标记/取消重点资讯',
		},
		{
			show: true,
			code:'del',
			type: 'danger',
			text: '批量删除',
		},
		{
			show: true,
			code:'add',
			type: 'primary',
			text: '新建',
		},
    ]
})
export const tableItem = reactive({
    select: true,//多选框
    index: false,//顺序
    expandAll: false,//树形默认展开
    align: 'center',
	column: [
		{
			label: '序号',
			prop: 'orderNum',
			width: 80,
		},
		{
			label: '标题',
			prop: 'title',
			tooltip: true,
		},
		{
			label: '所属类别',
			prop: 'catalogName',
		},
		{
			label: '课程类型',
			prop: 'courseTypeName',
			tooltip: true,
		},
		{
			label: '所属地区',
			prop: 'provinceName',
		},
		{
			label: '来源',
			prop: 'originSource',
			tooltip: true,
		},
		{
			label: '浏览量',
			prop: 'readAmount',
		},
		{
			label: '是否考试动态',
			htmlContent: row => {
				return `<span>${row.examStatusFlag == 1? ('是(' + row.examStatusName + ')') : '否'}</span>`
			},
		},
		{
			label: '是否重点资讯',
			htmlContent: row => {
				return `<span>${row.mainArticleFlag == 1? '是' : '否'}</span>`
			},
		},
		{
			label: '发布时间',
			prop: 'publishTime',
		},
		{
			label: '创建时间',
			prop: 'createTime',
		},
		{
			label: '状态',
			htmlContent: row => {
				return `<span>${row.publishedFlag == 1? '上架' : '下架'}</span>`
			},
		},
		{
			label: '操作',
			prop: 'action',
			width: '200px',
		}
    ],
    pageInfo: {
        request: {
			pageDomain:{}
		},
        pagesClose: false,//是否开启分页
        url: '/admin/article/paging',//分页路由，不传的话需要传入自定义的分页函数paging 传入时定义的分页函数paging会失效
    },
    // 分页数据 自定义分页函数paging时需要把值赋给tableData
    tableData: {
        total: 10,//分页总计
        // 分页数据
        data: []
    },
    // 操作栏按钮
    btnArray: [
        {
            type: 'primary',
            code: 'detail',
            label: '详情',
        },
        {
            type: 'primary',
            label: '修改',
            code: 'edit',
        },
		{
			type: 'primary',
			label: '上架',
			code: 'published',
			showFunction: (row)=>{
				return row.publishedFlag == 0;
			},
		},
		{
			type: 'danger',
			label: '下架',
			code: 'unpublished',
			showFunction: (row)=>{
				return row.publishedFlag == 1;
			},
		},
    ],
    // 选择框触发
    selectChange: function (row) {},
})
